<div class="site_section_header">
	Add/Edit pages
</div>

<input type="hidden" id="page_data_id" value="<?php echo $oPage->page_data_id; ?>" />

<div id="edit_page">
	<div class="ep_section">
		<div class="eps_header">
			<div class="eps_header_name">Page details</div>
			<div class="eps_header_toggle eps_header_toggle_down"><!-- --></div>
		</div>
		
		<div class="eps_content" style="display:block;">
			<div class="ep_field_wrapper">
				<label for="page_title">Page title</label>
				<div class="ep_field"><input name="page_title" id="page_title" type="text" value="<?php echo $oPage->page_title; ?>" class="editor" /></div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper">
				<label for="parent_page_id">Parent page</label> 
				<div class="ep_field">
					<select name="parent_page_id" id="parent_page_id" class="editorSelect">
						<option value=""></option>
					<?php
					for($i = 0; $i < $qPages->num_rows(); $i++)
					{
						?>
						<option<?php echo $qPages->row($i)->page_id == $oPage->page_parent_id ? ' selected="selected"' : ''; ?> value="<?php echo $qPages->row($i)->page_id; ?>"><?php echo $qPages->row($i)->page_menu_title; ?></option>
						<?php
					}
					?>
					</select>
				</div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper">
				<label for="page_seo_title">SEO title</label> 
				<div class="ep_field"><input name="page_seo_title" id="page_seo_title" type="text" value="<?php echo $oPage->page_name; ?>" class="editor" /></div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper">
				<label for="page_seo_keywords">SEO keywords</label>
				<div class="ep_field"><input name="page_seo_keywords" id="page_seo_keywords" type="text" value="<?php echo $oPage->page_keywords; ?>" class="editor longer" /></div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper">
				<label for="page_seo_description">SEO description</label> 
				<div class="ep_field"><input name="page_seo_description" id="page_seo_description" type="text" value="<?php echo $oPage->page_desc; ?>" class="editor longer" /></div>
				<div class="clear"><!-- --></div>
			</div>
		</div>
	</div>
	
	<div class="ep_section">
		<div class="eps_header">
			<div class="eps_header_name">Navigation</div>
			<div class="eps_header_toggle eps_header_toggle_up"><!-- --></div>
		</div>
		
		<div class="eps_content">
		<?php
		for($i = 0; $i < $qMenus->num_rows(); $i++)
		{
			?>
			<div class="ep_field_header"><?php echo $aMessages[$qMenus->row($i)->menu_ident]; ?></div>
			<div class="clear"><!-- --></div>
			<div class="ep_field_wrapper">
				<div class="ep_field_title"><?php echo $aMessages['admin_pages_menu_include_page']; ?></div>
				<div class="ep_field">
					<input type="checkbox" name="page_menu[]" id="page_menu_A_<?php echo $qMenus->row($i)->menu_id; ?>" value="A"<?php 
					if ($qMenus->row($i)->menu_appears === true) {
						echo ' checked="checked"';
					}
					
					?> />
				</div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper">
				<div class="ep_field_title"><?php echo $aMessages['admin_pages_menu_include_menu']; ?></div>
				<div class="ep_field">
					<input type="checkbox" name="page_menu[]" id="page_menu_H_<?php echo $qMenus->row($i)->menu_id; ?>" value="H"<?php 
					if ($qMenus->row($i)->menu_has === true) {
						echo ' checked="checked"';
					}
					
					?> />
				</div>
				<div class="clear"><!-- --></div>
			</div>
			<?php
		}
		?>
		</div>
	</div>
	
	<div class="ep_section">
		<div class="eps_header">
			<div class="eps_header_name">Content</div>
			<div class="eps_header_toggle eps_header_toggle_up"><!-- --></div>
		</div>
		
		<div class="eps_content">
			<textarea name="page_content" id="page_content" style="width:715px; height:500px;"><?php echo $oPage->page_content; ?></textarea>
		</div>
	</div>
	
	<div class="ep_section">
		<div class="eps_header">
			<div class="eps_header_name">Components</div>
			<div class="eps_header_toggle eps_header_toggle_up"><!-- --></div>
		</div>
		
		<div class="eps_content">
			<div class="ep_field_wrapper" style="display:none;">
				<div class="ep_field_title">Left of content</div> 
				<div class="ep_field">
					<select name="components_L" id="components_L" multiple="multiple">
					<?php
					for($i = 0; $i < $qComponents->num_rows(); $i++)
					{
						?>
						<option<?php echo (isset($aPageDataComponents['L']) && in_array($qComponents->row($i)->component_id, $aPageDataComponents['L'])) ? ' selected="selected"' : ''; ?> value="<?php echo $qComponents->row($i)->component_id; ?>"><?php echo $qComponents->row($i)->component_name; ?></option>
						<?php
					}
					?>
					</select>
				</div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper" style="display:none;">
				<div class="ep_field_title">Above content</div> 
				<div class="ep_field">
					<select name="components_A" id="components_A" multiple="multiple">
					<?php
					for($i = 0; $i < $qComponents->num_rows(); $i++)
					{
						?>
						<option<?php echo (isset($aPageDataComponents['A']) && in_array($qComponents->row($i)->component_id, $aPageDataComponents['A'])) ? ' selected="selected"' : ''; ?> value="<?php echo $qComponents->row($i)->component_id; ?>"><?php echo $qComponents->row($i)->component_name; ?></option>
						<?php
					}
					?>
					</select>
				</div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper" style="display:none;">
				<div class="ep_field_title">Below content</div> 
				<div class="ep_field">
					<select name="components_B" id="components_B" multiple="multiple">
					<?php
					for($i = 0; $i < $qComponents->num_rows(); $i++)
					{
						?>
						<option<?php echo (isset($aPageDataComponents['B']) && in_array($qComponents->row($i)->component_id, $aPageDataComponents['B'])) ? ' selected="selected"' : ''; ?> value="<?php echo $qComponents->row($i)->component_id; ?>"><?php echo $qComponents->row($i)->component_name; ?></option>
						<?php
					}
					?>
					</select>
				</div>
				<div class="clear"><!-- --></div>
			</div>
			<div class="ep_field_wrapper">
				<div class="ep_field_title">Right of content</div> 
				<div class="ep_field">
					<select name="components_R" id="components_R" multiple="multiple" class="editorSelect">
					<?php
					for($i = 0; $i < $qComponents->num_rows(); $i++)
					{
						?>
						<option<?php echo (isset($aPageDataComponents['R']) && in_array($qComponents->row($i)->component_id, $aPageDataComponents['R'])) ? ' selected="selected"' : ''; ?> value="<?php echo $qComponents->row($i)->component_id; ?>"><?php echo $qComponents->row($i)->component_name; ?></option>
						<?php
					}
					?>
					</select>
				</div>
				<div class="clear"><!-- --></div>
			</div>
		</div>
	</div>
	
	<div class="ep_section">
		<div class="eps_header">
			<div class="eps_header_name">Banner</div>
			<div class="eps_header_toggle eps_header_toggle_up"><!-- --></div>
		</div>
		
		<div class="eps_content">
			<select name="page_banner" id="page_banner" class="editorSelect">
				<option value=""></option>
				<?php
				for($i = 0; $i < $qBanners->num_rows(); $i++)
				{
				?>
				<option<?php echo (isset($iPageDataBanner) && $iPageDataBanner == $qBanners->row($i)->banner_id) ? ' selected="selected"' : ''; ?> value="<?php echo $qBanners->row($i)->banner_id; ?>"><?php echo $qBanners->row($i)->banner_name; ?></option>
				<?php
				}
				?>
			</select>
		</div>
	</div>
	
	<div class="ep_section">
		<a id="page_save" href="#"><img src="/assets/images/web/admin/buttons/save.png" style="border:none;" /></a> 
		<a href="/admin/pages" onclick="return confirm('Are you sure you want to quit, any changes will be lost?');"><img src="/assets/images/web/admin/buttons/cancel.png" style="border:none;" /></a>
	</div>
</div>